<template>
    <div>
        <div>基础信息</div>
        <div class="pw100 flex_aj column">
            <r-list :ListRows="ListRows" :ListData="ListData"></r-list>
        </div>
        <div class="flex_aj" v-if="ListData.state==3">
            <el-button v-if="$store.state.buttons[1001]" @click="enterTakeCash(1)" class="mt20" type="success">确认提现</el-button>
            <el-button v-if="$store.state.buttons[1002]" @click="enterTakeCash(2)" class="mt20" type="danger">拒绝提现</el-button>
        </div>

    </div>
</template>
<script>
export default {
    data() {
        return {
            ListRows: [
                [
                    {
                        label: '订单编号',
                        prop: 'number',
                    },
                    {
                        label: '用户账号',
                        prop: 'theActualAmount',
                    },
                    {
                        label: '状态',
                        prop: 'state',
                        formatter: e => e.state == 1 ? '审核通过' : e.state == 2 ? '审核不通过' : e.state == 3 ? '待审核' : '',
                    },
                    {
                        label: '提现金额(元)',
                        prop: 'money',
                    },
                    {
                        label: '确认提现金额(元)',
                        prop: 'Entermoney',
                        type: 'input',
                        isShow: e => false
                    },
                    {
                        label: '银行信息',
                        prop: 'bankInfo',
                        formatter:e=>e&&e.bankInfo&&'卡号:'+JSON.parse(e.bankInfo).bankCard+' 开户支行:'+JSON.parse(e.bankInfo).bank+' 持卡人:'+JSON.parse(e.bankInfo).holder
                    },
                    {
                        label: '提现人',
                        prop: 'name',
                    },
                    {
                        label: '提现类型',
                        prop: 'type',
                        formatter:e=>e.type==1?'银行卡':e.type==2?'微信':e.type==3?'支付宝':''
                    },
                    {
                        label: '处理备注',
                        prop: 'remark',
                        type: 'input',
                        isDisable: e => e.state == 1 ? true : true
                    },

                ]
            ],
            ListData: {
            }
        };
    },
    components: {},
    computed: {},
    mounted() {
        this.init()
    },
    methods: {
        async init() {
            let res = await this.api.takecashList({
                number: this.$route.query.number,
                sType: '2'
            })
            if (res) {
                this.ListData = res.data.list[0]
                this.ListData.Entermoney = this.ListData.money

            }
        },
        // 确认提现
        async enterTakeCash(tp) {
            this.ListData.state = tp//状态
            // console.log(this.ListData);
            let res = await this.api.withdraw({
                id: this.ListData.id,
                money: this.ListData.Entermoney,
                state: tp,
                remark: this.ListData.remark
            })
            if (res) {
                this.$router.replace('/moneyManagement-takeCash')
            } else {
                this.init()
            }
        },
        // 拒绝提现
        rejectTakeCash() {

        }
    }
};
</script>
<style scoped lang='scss'>
</style>
